package com.ml.mall.service.asyn;

import com.ml.mall.bean.req.BaseDateRangeReq;
import com.ml.mall.bean.req.admin.coupon.CouponQueryOneReq;
import com.ml.mall.bean.req.admin.supplier.SupplierQueryOneByCategoryReq;
import com.ml.mall.bean.req.admin.supplier.SupplierQueryOneByPurchaseReq;
import com.ml.mall.bean.req.admin.supplier.SupplierQueryOneReq;
import com.ml.mall.bean.req.admin.supplier.SupplierQueryPageReq;
import com.ml.mall.bean.req.admin.variant.VariantQueryOneReq;
import com.ml.mall.bean.req.admin.variant.VariantQueryPageReq;
import com.ml.mall.bean.res.admin.*;
import com.ml.mall.bean.res.admin.category.AdminCategoryQueryPageRes;
import com.ml.mall.bean.res.admin.category.AdminCategoryQueryReportPageRes;
import com.ml.mall.bean.res.admin.category.CategoryQuerySubcategoryTotalfeeRes;
import com.ml.mall.bean.res.admin.variant.VariantQueryPageRes;
import com.ml.mall.bean.res.admin.variant.VariantQueryTopRes;
import com.ml.mall.bean.res.admin.variant.vo.VariantQueryOneVO;
import com.ml.mall.bean.res.admin.variant.vo.VariantQueryTopVO;
import com.ml.mall.bean.res.admin.vo.AdminOverviewSalesByCategoryVO;
import com.ml.mall.bean.res.admin.vo.AdminOverviewSalesByCountryVO;
import com.ml.mall.bean.res.admin.vo.AdminOverviewSalesByIndustryVO;
import com.ml.mall.bean.res.admin.supplier.SupplierQueryOneByCategoryRes;
import com.ml.mall.bean.res.admin.supplier.SupplierQueryOneByPurchaseRes;
import com.ml.mall.bean.res.admin.supplier.SupplierQueryPageRes;
import com.ml.mall.bean.res.admin.supplier.vo.SupplierQueryOneVO;
import com.ml.mall.bean.vo.CouponVO;
import com.ml.mall.bean.vo.DateValueVO;
import com.ml.mall.config.RedisConfiguration;
import com.ml.mall.mapper.AnalyticsAdminMapper;
import com.ml.mall.mapper.AnalyticsPurchaseMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.util.List;
import java.util.concurrent.Future;

/**
 * Created by kyyang on 2021/6/8 22:32
 */
@Component
@Slf4j
public class AnalyticsAdminServiceAsyn {


    @Autowired
    private AnalyticsAdminMapper analyticsAdminMapper;


    /**
     * @description: 根据州属销售 排名 top N
     * @author kyyang
     * @date 2021/6/8 22:47
     * @version 1.0
     */
    @Async
    public Future<List<AdminOverviewSalesByCountryVO>> selectSalesByStatesNameTopN(String timeBegin, String timeEnd, Long supplierId) {
        List<AdminOverviewSalesByCountryVO> list;
        if(supplierId != null){
            //商户查询
            list = analyticsAdminMapper.selectSupplierSalesByStatesName(timeBegin,timeEnd,supplierId);
        }else{
            list = analyticsAdminMapper.selectSalesByStatesName(timeBegin,timeEnd);
        }
        return new AsyncResult<>(list);
    }

    /**
     * @description: 根据时间范围查询公司注册数量
     * @author kyyang
     * @date 2021/6/9 22:12
     * @version 1.0
     */
    @Async
    public Future<List<DateValueVO>> selectRegisterCompanyByDateRange(String timeBegin, String timeEnd,Integer type) {
        List<DateValueVO> list = analyticsAdminMapper.selectRegisterCompanyByDateRange(timeBegin,timeEnd,type);
        return new AsyncResult<>(list);
    }

    /**
     * @description: 根据时间范围查询 券使用情况
     * @author kyyang
     * @date 2021/6/9 22:15
     * @version 1.0
     */
    @Async
    public Future<List<CouponVO>> selectCouponUsesByDateRange(String timeBegin, String timeEnd) {
        List<CouponVO> list = analyticsAdminMapper.selectCouponUsesByDateRange(timeBegin,timeEnd);
        return new AsyncResult<>(list);
    }

    /**
     * @description: 根据时间范围 分类（最顶层） 查询 top N
     * @author kyyang
     * @date 2021/6/9 23:36
     * @version 1.0
     */
    @Async
    public Future<List<AdminOverviewSalesByCategoryVO>> selectSalesByCategoryTopN(int topN, String timeBegin, String timeEnd, Long supplierId, Long companyId) {
        List<AdminOverviewSalesByCategoryVO> list;
        if(supplierId != null){
           log.info("selectSalesByCategoryTopN==={}");
           list = analyticsAdminMapper.selectSupplierSalesByCategoryTopN(topN,timeBegin,timeEnd,supplierId,companyId);
            log.info("selectSalesByCategoryTopN==={}",list);
        }else{
            list = analyticsAdminMapper.selectSalesByCategoryTopN(topN,timeBegin,timeEnd,companyId);
        }
        return new AsyncResult<>(list);
    }

    /**
     * @description: 根据时间范围 产业 （分类中） 查询 top N
     * @author kyyang
     * @date 2021/6/9 23:38
     * @version 1.0
     */
    @Async
    public Future<List<AdminOverviewSalesByIndustryVO>> selectSalesByIndustryTopN(int topN, String timeBegin, String timeEnd) {
        List<AdminOverviewSalesByIndustryVO> list = analyticsAdminMapper.selectSalesByIndustryTopN(topN,timeBegin,timeEnd);
        return new AsyncResult<>(list);
    }

    /**
     * @description: 查询时间范围内 销售金额
     * @author kyyang
     * @date 2021/6/15 21:38
     * @version 1.0
     */
    @Async
    public Future<BigDecimal> selectSalesByTimeLine(String timeBegin, String timeEnd) {
       BigDecimal bigDecimal = analyticsAdminMapper.selectSalesByTimeLine(timeBegin,timeEnd);
       return new AsyncResult<>(bigDecimal);
    }

    /**
     * @description: 查询时间范围内 买家订单数
     * @author kyyang
     * @date 2021/6/15 22:53
     * @version 1.0
     */
    @Async
    public Future<List<DateValueVO>> selectPurchaseOrderByTimeLine(String timeBegin, String timeEnd, Long companyId, Long supplierId) {
        List<DateValueVO> list;
        if(supplierId != null){
            list = analyticsAdminMapper.selectSupplierPurchaseOrderByTimeLine(timeBegin,timeEnd,companyId,supplierId);
        }else{
            list = analyticsAdminMapper.selectPurchaseOrderByTimeLine(timeBegin,timeEnd,companyId);
        }
        return new AsyncResult<>(list);
    }

    /**
     * @description: 查询时间范围内 买家花费金额
     * @author kyyang
     * @date 2021/6/15 22:53
     * @version 1.0
     */
    @Async
    public Future<List<DateValueVO>> selectPurchaseSpentByTimeLine(String timeBegin, String timeEnd, Long companyId, Long supplierId) {
        List<DateValueVO> list;
        if(supplierId != null){
            list = analyticsAdminMapper.selectSupplierPurchaseSpentByTimeLine(timeBegin,timeEnd,companyId,supplierId);
        }else{
            list = analyticsAdminMapper.selectPurchaseSpentByTimeLine(timeBegin,timeEnd,companyId);
        }
        return new AsyncResult<>(list);
    }

    /**
     * @description: 查询时间范围内 买家消费数量
     * @author kyyang
     * @date 2021/6/16 22:12
     * @version 1.0
     */
    @Async
    public Future<Integer> selectAdminPurchaseQueryReportPageCount(String timeBegin, String timeEnd, int sortType, String companyName, Long supplierId) {
      Integer count;
      if(supplierId != null){
          count =  analyticsAdminMapper.selectSupplierPurchaseQueryReportPageCount(timeBegin,timeEnd,sortType,companyName,supplierId);
      }else{
          count =  analyticsAdminMapper.selectAdminPurchaseQueryReportPageCount(timeBegin,timeEnd,sortType,companyName);
      }
      return new AsyncResult<>(count);
    }

    /**
     * @description: 查询时间范围内 买家消费 记录汇总
     * @author kyyang
     * @date 2021/6/16 22:27
     * @version 1.0
     */
    @Async
    public Future<List<PurchaseReportPageRes>> selectAdminPurchaseQueryReportPageList(String timeBegin, String timeEnd, int sortType, String companyName, int start, int end, Long supplierId) {
        List<PurchaseReportPageRes> list;
        if(supplierId != null ){
            list =  analyticsAdminMapper.selectSupplierPurchaseQueryReportPageList(timeBegin,timeEnd,sortType,companyName,start,end,supplierId);
        }else{
            list =  analyticsAdminMapper.selectAdminPurchaseQueryReportPageList(timeBegin,timeEnd,sortType,companyName,start,end);
        }
        return new AsyncResult<>(list);
    }

    /**
     * @description: 买家消费目录：分页查询 数量
     * @author kyyang
     * @date 2021/6/16 23:22
     * @version 1.0
     */
    @Async
    public Future<Integer> selectAdminPurchaseSpentByCategoryPageCount(String timeBegin, String timeEnd, int sortType, Long companyId) {
      int count =  analyticsAdminMapper.selectAdminPurchaseSpentByCategoryPageCount(timeBegin,timeEnd,companyId);
      return new AsyncResult<>(count);
    }

    /**
     * @description: 买家消费目录：分页查询 记录明细
     * @author kyyang
     * @date 2021/6/16 23:22
     * @version 1.0
     */
    @Async
    public Future<List<PurchaseByNameSpentRes>> selectAdminPurchaseSpentByCategoryPageList(String timeBegin, String timeEnd, int sortType, Long companyId, int start, int end) {
        List<PurchaseByNameSpentRes> list =  analyticsAdminMapper.selectAdminPurchaseSpentByCategoryPageList(timeBegin,timeEnd,sortType,companyId,start,end);
        return new AsyncResult<>(list);
    }

    /**
     * @description: 买家消费卖家：分页查询 数量
     * @author kyyang
     * @date 2021/6/16 23:22
     * @version 1.0
     */
    @Async
    public Future<Integer> selectAdminPurchaseSpentBySupplierPageCount(String timeBegin, String timeEnd, int sortType, Long companyId) {
        int count =  analyticsAdminMapper.selectAdminPurchaseSpentBySupplierPageCount(timeBegin,timeEnd,companyId);
        return new AsyncResult<>(count);
    }

    /**
     * @description: 买家消费卖家：分页查询 记录明细
     * @author kyyang
     * @date 2021/6/16 23:22
     * @version 1.0
     */
    @Async
    public Future<List<PurchaseByNameSpentRes>> selectAdminPurchaseSpentBySupplierPageList(String timeBegin, String timeEnd, int sortType, Long companyId, int start, int end) {
        List<PurchaseByNameSpentRes> list =  analyticsAdminMapper.selectAdminPurchaseSpentBySupplierPageList(timeBegin,timeEnd,sortType,companyId,start,end);
        return new AsyncResult<>(list);
    }

    /**
     * @description: 买家消费产品：分页查询 数量
     * @author kyyang
     * @date 2021/6/16 23:22
     * @version 1.0
     */
    @Async
    public Future<Integer> selectAdminPurchaseSpentByProductPageCount(String timeBegin, String timeEnd, int sortType, Long companyId) {
        int count =  analyticsAdminMapper.selectAdminPurchaseSpentByProductPageCount(timeBegin,timeEnd,companyId);
        return new AsyncResult<>(count);
    }

    /**
     * @description: 买家消费产品：分页查询 记录明细
     * @author kyyang
     * @date 2021/6/16 23:22
     * @version 1.0
     */
    @Async
    public Future<List<PurchaseByProductSpentRes>> selectAdminPurchaseSpentByProductPageList(String timeBegin, String timeEnd, int sortType, Long companyId, int start, int end) {
        List<PurchaseByProductSpentRes> list =  analyticsAdminMapper.selectAdminPurchaseSpentByProductPageList(timeBegin,timeEnd,sortType,companyId,start,end);
        return new AsyncResult<>(list);
    }

    /**
     * @description: industry:前10 industryId 每日数据 明细数据
     * @author kyyang
     * @date 2021/6/19 22:41
     * @version 1.0
     */
    public List<DateValueVO> selectIndustryDetailByTimeLine(Long industryId, String timeBegin, String timeEnd) {
        return analyticsAdminMapper.selectIndustryDetailByTimeLine(timeBegin,timeEnd,industryId);
    }

    /**
     * @description: industry：分页查询 总记录数
     * @author kyyang
     * @date 2021/6/21 21:37
     * @version 1.0
     */
    @Async
    public Future<Integer> selectAdminIndustryQueryPagePageCount(String timeBegin, String timeEnd, int sortType, String industryName) {
        Integer count = analyticsAdminMapper.selectAdminIndustryQueryPagePageCount(timeBegin,timeEnd,industryName);
        return new AsyncResult<>(count);
    }

    /**
     * @description: industry：分页查询 记录明细
     * @author kyyang
     * @date 2021/6/21 21:37
     * @version 1.0
     */
    @Async
    public Future<List<AdminIndustryQueryRes>> selectAdminIndustryQueryPagePageList(String timeBegin, String timeEnd, int sortType, String industryName, int start, int end) {
        List<AdminIndustryQueryRes> list =  analyticsAdminMapper.selectAdminIndustryQueryPagePageList(timeBegin,timeEnd,sortType,industryName,start,end);
        return new AsyncResult<>(list);
    }

    /**
     * @description: 查询某一个产业的汇总明细
     * @author kyyang
     * @date 2021/6/21 22:08
     * @version 1.0
     */
    @Async
    public Future<List<DateValueVO>> selectAdminIndustryQueryOne(String timeBegin, String timeEnd, String industryId) {
        List<DateValueVO> list =  analyticsAdminMapper.selectAdminIndustryQueryOne(timeBegin,timeEnd,industryId);
        return new AsyncResult<>(list);
    }

    /**
     * @description: 管理员查询全部订单；
     * @author kyyang
     * @date 2021/6/21 22:42
     * @version 1.0
     */
    public List<DateValueVO> selectCategoryDetailByTimeLine(String categoryId, String timeBegin, String timeEnd, Long supplierId) {
        List<DateValueVO> list;
        if(supplierId != null){
            list = analyticsAdminMapper.selectSupplierCategoryDetailByTimeLine(timeBegin,timeEnd,categoryId,supplierId);
        }else{
            list =  analyticsAdminMapper.selectCategoryDetailByTimeLine(timeBegin,timeEnd,categoryId);
        }
        return list;
    }

    /**
     * @description: 管理员分页查询目录报告 总记录数
     * @author kyyang
     * @date 2021/6/22 21:40
     * @version 1.0
     */
    @Async
    public Future<Integer> selectAdminCategoryQueryPageCount(String timeBegin, String timeEnd, int sortType, String categoryName,Long supplierId) {
        Integer count = analyticsAdminMapper.selectAdminCategoryQueryPageCount(timeBegin,timeEnd,categoryName,supplierId);
        return new AsyncResult<>(count);
    }
    /**
     * @description: 管理员分页查询目录报告 记录明细
     * @author kyyang
     * @date 2021/6/22 21:40
     * @version 1.0
     */
    @Async
    public Future<List<AdminCategoryQueryPageRes>> selectAdminCategoryQueryPageList(String categoryId,String timeBegin, String timeEnd, int sortType, String categoryName, int start, int end,Long supplierId) {
        List<AdminCategoryQueryPageRes> list ;
        if(supplierId != null){
            list =  analyticsAdminMapper.selectSupplierCategoryQueryPageList(categoryId,timeBegin,timeEnd,sortType,categoryName,start,end,supplierId);
        }else{
            list =  analyticsAdminMapper.selectAdminCategoryQueryPageList(timeBegin,timeEnd,sortType,categoryName,start,end);
        }
        return new AsyncResult<>(list);
    }

    /**
     * @description: 行业下产品属供销商 销售额分页查询 总记录数
     * @author kyyang
     * @date 2021/6/22 22:08
     * @version 1.0
     */
    @Async
    public Future<Integer> selectAdminIndustrySupplierPageCount(String timeBegin, String timeEnd, String supplierName, Long industryId) {
        Integer count = analyticsAdminMapper.selectAdminIndustrySupplierPageCount(timeBegin,timeEnd,supplierName,industryId);
        return new AsyncResult<>(count);
    }

    /**
     * @description: 行业下产品属供销商 销售额分页查询 记录明细
     * @author kyyang
     * @date 2021/6/22 22:08
     * @version 1.0
     */
    @Async
    public Future<List<AdminIndustrySupplierQueryRes>> selectAdminIndustrySupplierQueryPageList(String timeBegin, String timeEnd, int sortType, String supplierName, int start, int end, Long industryId) {
        List<AdminIndustrySupplierQueryRes> list = analyticsAdminMapper.selectAdminIndustrySupplierQueryPageList(timeBegin, timeEnd, sortType, supplierName, start, end, industryId);
        return new AsyncResult<>(list);
    }

    /**
     * @description: 查询某一目录详细：每日详细
     * @author kyyang
     * @date 2021/6/22 23:12
     * @version 1.0
     */
    @Async
    public Future<List<DateValueVO>> adminCategoryQueryOne(String timeBegin, String timeEnd, String categoryId, Long supplierId) {
        List<DateValueVO> list;
        if(supplierId != null){
            list  =  analyticsAdminMapper.supplierCategoryQueryOne(timeBegin,timeEnd,categoryId,supplierId);
        }else{
            list  =  analyticsAdminMapper.adminCategoryQueryOne(timeBegin,timeEnd,categoryId);
        }
        return new AsyncResult<>(list);
    }

    /**
     * @description: category：report_page 分页总记录数
     * @author kyyang
     * @date 2021/6/22 23:31
     * @version 1.0
     */
    @Async
    public Future<Integer> selectAdminCategoryQueryReportPageCount(String timeBegin, String timeEnd, String categoryName, String industryId, Long supplierId) {
        Integer count = analyticsAdminMapper.selectAdminCategoryQueryReportPageCount(timeBegin,timeEnd,categoryName,industryId,supplierId);
        return new AsyncResult<>(count);
    }

    /**
     * @description: category：report_page 分页 记录明细
     * @author kyyang
     * @date 2021/6/22 23:31
     * @version 1.0
     */
    @Async
    public Future<List<AdminCategoryQueryReportPageRes>> selectAdminCategoryQueryReportPageList(String timeBegin, String timeEnd, int sortType, String categoryName, String industryId, int start, int end,Long supplierId) {
        List<AdminCategoryQueryReportPageRes> list;
        if(supplierId != null){
            list = analyticsAdminMapper.selectSupplierCategoryQueryReportPageList(timeBegin, timeEnd, sortType, categoryName,industryId ,start, end ,supplierId);
        }else{
            list = analyticsAdminMapper.selectAdminCategoryQueryReportPageList(timeBegin, timeEnd, sortType, categoryName,industryId ,start, end);
        }
        return new AsyncResult<>(list);
    }

    /**
     * @description: 产品变体查询分析报告：前10名 汇总
     * @author kyyang
     * @date 2021/6/22 23:31
     * @version 1.0
     */
    @Async
    public Future<List<VariantQueryTopRes>> selectAdminVariantQueryTop(BaseDateRangeReq req, int topN,Long supplierId) {
        List<VariantQueryTopRes> list;
        if(supplierId != null){
            list = analyticsAdminMapper.selectSupplierVariantQueryTop(req.getTimeBegin(),req.getTimeEnd(),topN,supplierId);
        }else{
            list = analyticsAdminMapper.selectAdminVariantQueryTop(req.getTimeBegin(),req.getTimeEnd(),topN);
        }
        return new AsyncResult<>(list);
    }
    /**
     * @description: 产品变体查询分析报告：根据时间段查询明细
     * @author kyyang
     * @date 2021/6/22 23:31
     * @version 1.0
     */
    public List<VariantQueryTopVO> selectAdminVariantQueryOneByTimeLine(String timeBegin, String timeEnd, String variantId,Long supplierId) {
        List<VariantQueryTopVO> list;
        if(supplierId != null){
            list = analyticsAdminMapper.selectSupplierVariantQueryOneByTimeLine(timeBegin,timeEnd,variantId,supplierId);
        }else{
            list = analyticsAdminMapper.selectAdminVariantQueryOneByTimeLine(timeBegin,timeEnd,variantId);
        }
        return list;
    }

    /**
     * @description:
     * @author 查询某一个目录子目录的销售额；根目录查一级；一级查二级；找parentId 等于 传入id的子目录就行了
     * @date 2021/6/24 23:06
     * @version 1.0
     */
    @Async
    public Future<List<CategoryQuerySubcategoryTotalfeeRes>> selectAdminCategoryQuerySubcategoryTotalfee(String timeBegin, String timeEnd, String categoryId) {
        List<CategoryQuerySubcategoryTotalfeeRes> list = analyticsAdminMapper.selectAdminCategoryQuerySubcategoryTotalfee(timeBegin,timeEnd,categoryId);
        return new AsyncResult<>(list);
   }

   /**
    * @description: 根据 variantId 时间段查询销售
    * @author kyyang
    * @date 2021/6/25 22:31
    * @version 1.0
    */
   @Async
    public Future<List<VariantQueryOneVO>> selectAdminVariantQueryOneDetail(VariantQueryOneReq req,Long supplierId) {
       List<VariantQueryOneVO> list;
       if(supplierId != null){
           list = analyticsAdminMapper.selectSupplierVariantQueryOneDetail(req.getTimeBegin(),req.getTimeEnd(),req.getVariantId(),supplierId);
       }else{
           list = analyticsAdminMapper.selectAdminVariantQueryOneDetail(req.getTimeBegin(),req.getTimeEnd(),req.getVariantId());
       }
       return new AsyncResult<>(list);
    }

    @Cacheable(value = RedisConfiguration.REDIS_DATA_I_H_CACHE)
    /**
     * @description: 根据日期 variantId 查询 单价
     * @author kyyang
     * @date 2021/6/26 14:40
     * @version 1.0
     */
    public VariantQueryOneVO selectVariantPriceAndSalesByYmd(String variantId, String ymd,Long supplierId) {
        VariantQueryOneVO vo =  analyticsAdminMapper.selectVariantPriceAndSalesByYmd(variantId,ymd,supplierId);
        return vo;
    }

    /**
     * @description: 分页查询 sku 记录总数
     * @author kyyang
     * @date 2021/6/26 14:41
     * @version 1.0
     */
    @Async
    public Future<Integer> selectAdminVariantQueryPageCount(VariantQueryPageReq req,Long supplierId) {
        Integer count;
        if(supplierId != null){
            count = analyticsAdminMapper.selectSupplierVariantQueryPageCount(req,supplierId);
        }else{
             count = analyticsAdminMapper.selectAdminVariantQueryPageCount(req);
        }
        return new AsyncResult<>(count);
    }

    /**
     * @description: 分页查询 sku 记录明细
     * @author kyyang
     * @date 2021/6/26 14:41
     * @version 1.0
     */
    @Async
    public Future<List<VariantQueryPageRes>> selectAdminVariantQueryPageList(VariantQueryPageReq req,Long supplierId) {
        List<VariantQueryPageRes> list ;
        if(supplierId != null){
            list = analyticsAdminMapper.selectSupplierVariantQueryPageList(req,supplierId);
        }else{
            list = analyticsAdminMapper.selectAdminVariantQueryPageList(req);
        }
        return new AsyncResult<>(list);
    }

    /**
     * @description: 查询供应商统计
     * @author kyyang
     * @date 2021/6/26 17:01
     * @version 1.0
     */
    @Async
    public Future<List<DateValueVO>> adminSupplierQueryReport(String timeBegin, String timeEnd) {
        List<DateValueVO> list = analyticsAdminMapper.adminSupplierQueryReport(timeBegin,timeEnd);
        return new AsyncResult<>(list);
    }

    /**
     * @description: 分页查询供应商统计 统计数
     * @author kyyang
     * @date 2021/6/26 17:45
     * @version 1.0
     */
    @Async
    public Future<Integer> adminSupplierQueryPageCount(SupplierQueryPageReq req) {
        Integer count = analyticsAdminMapper.adminSupplierQueryPageCount(req.getTimeBegin(),req.getTimeEnd(),req.getCompanyName());
        return new AsyncResult<>(count);
    }

    /**
     * @description: 分页查询供应商统计 记录明细
     * @author kyyang
     * @date 2021/6/26 17:45
     * @version 1.0
     */
    @Async
    public Future<List<SupplierQueryPageRes>> adminSupplierQueryPageList(SupplierQueryPageReq req) {
        List<SupplierQueryPageRes> list = analyticsAdminMapper.adminSupplierQueryPageList(req.getTimeBegin(),req.getTimeEnd(),req.getCompanyName(),req.getSortType(),req.getStart(),req.getEnd());
        return new AsyncResult<>(list);
    }

    /**
     * @description: 某一供应商报告
     * @author kyyang
     * @date 2021/6/26 18:59
     * @version 1.0
     */
    @Async
    public Future<List<SupplierQueryOneVO>> adminSupplierQueryOne(SupplierQueryOneReq req) {
        List<SupplierQueryOneVO> list = analyticsAdminMapper.adminSupplierQueryOne(req.getTimeBegin(),req.getTimeEnd(),req.getCompanyId());
        return new AsyncResult<>(list);
    }

    /**
     * @description: 查询某一个公司 时间范围内 目录销售额 总记录数
     * @author kyyang
     * @date 2021/6/26 19:20
     * @version 1.0
     */
    @Async
    public Future<Integer> adminSupplierQueryOneByCategoryCount(SupplierQueryOneByCategoryReq req) {
        Integer count = analyticsAdminMapper.adminSupplierQueryOneByCategoryCount(req.getTimeBegin(),req.getTimeEnd(),req.getCompanyId(),req.getCategoryName());
        return new AsyncResult<>(count);
    }

    /**
     * @description: 查询某一个公司 时间范围内 目录销售额 记录明细
     * @author kyyang
     * @date 2021/6/26 19:20
     * @version 1.0
     */
    @Async
    public Future<List<SupplierQueryOneByCategoryRes>> adminSupplierQueryOneByCategoryList(SupplierQueryOneByCategoryReq req) {
        List<SupplierQueryOneByCategoryRes> list = analyticsAdminMapper.adminSupplierQueryOneByCategoryList(req.getTimeBegin(),req.getTimeEnd(),req.getCompanyId(),req.getCategoryName(),req.getSortType(),req.getStart(),req.getEnd());
        return new AsyncResult<>(list);
    }

    /**
     * @description: 某卖家下买家消费分页 总记录数
     * @author kyyang
     * @date 2021/6/26 20:36
     * @version 1.0
     */
    @Async
    public Future<Integer> adminSupplierQueryOneByPurchasePageCount(SupplierQueryOneByPurchaseReq req) {
        Integer count = analyticsAdminMapper.adminSupplierQueryOneByPurchasePageCount(req.getTimeBegin(),req.getTimeEnd(),req.getSupplierId(),req.getCompanyName());
        return new AsyncResult<>(count);
    }
    /**
     * @description: 某卖家下买家消费分页 记录明细
     * @author kyyang
     * @date 2021/6/26 20:36
     * @version 1.0
     */
    @Async
    public Future<List<SupplierQueryOneByPurchaseRes>> adminSupplierQueryOneByPurchasePageList(SupplierQueryOneByPurchaseReq req) {
        List<SupplierQueryOneByPurchaseRes> list = analyticsAdminMapper.selectAdminSupplierQueryOneByPurchasePageList(req.getTimeBegin(),req.getTimeEnd(),req.getSupplierId(),req.getCompanyName(),req.getSortType(),req.getStart(),req.getEnd());
        return new AsyncResult<>(list);
    }

    /**
     * @description: 某张券消费情况
     * @author kyyang
     * @date 2021/6/26 21:05
     * @version 1.0
     */
    @Async
    public Future<List<DateValueVO>> selectAdminCouponQueryOne(CouponQueryOneReq req) {
        List<DateValueVO> list = analyticsAdminMapper.selectAdminCouponQueryOne(req.getTimeBegin(),req.getTimeEnd(),req.getCouponCode());
        return new AsyncResult<>(list);
    }

}
